<style>
    .fui-cell-group .fui-cell.fui-cell-credit:before{border:none;}
    .fui-cell-group .fui-cell.fui-cell-credit{padding:0.2rem 0.5rem;}
    .fui-cell-group .fui-cell.fui-cell-credit .fui-cell-text{color:#666;font-size:0.6rem;}
    .fui-navbar ~ .fui-content, .fui-content.navbar{padding:0;}
    .fui-footer.btn-disabled{background: #ddd;color: #bbb;line-height: 2.4rem;text-align: center;}
    #basic img{max-width: 100%;display: block;}
</style>
<link rel="stylesheet" href="../addons/jy_creditshop/resource/css/common-new.css" />
<link rel="stylesheet" href="../addons/jy_creditshop/resource/css/common.css?v=2" />
<div class='fui-page  fui-page-current creditshop-detail-page'>
        <div class="fui-header">
            <div class="fui-header-left" ng-click="goback()">
                <a class="back"></a>
            </div>
            <div class="title">商品详情</div>
            <div class="fui-header-right"></div>
        </div>
    <div class='fui-content navbar'>
        <!-- 商品图片 -->
        <div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="max-height:20rem">
				<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.goods.images">
					<a href="#">
						<img ng-src="{{tomedia(item) || '../core/resource/images/nopic.jpg'}}" style="display: block; width: 100%; height: 100%;">
					</a>
				</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
						<div class="fui-swipe-bullet" ng-repeat="item in pagedata.goods.images" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
			<div ng-if="pagedata.goods.timestate && pagedata.goods.istime==1" class="fui-swipe-layer">
                <i class="icon jinyunicon icon-history"></i>
                <span id="divdown1"></span>
            </div>
		</div>
        <div class="fui-cell-group fui-detail-group">
            <div class="fui-cell">
                <div class="fui-cell-text name">
                    <label ng-if="pagedata.goods.goodstype==0">商品</label>
                    <label ng-if="pagedata.goods.goodstype==1">优惠券</label>
                    <label ng-if="pagedata.goods.goodstype==2">余额</label>
                    <label ng-if="pagedata.goods.goodstype==3">红包</label>
                    <span>{{pagedata.goods.title}}</span>
                </div>
            </div>
                <div ng-if="(pagedata.goods.isverify==1 && pagedata.goods.usetime>0 && pagedata.goods.isendtime==0)||(pagedata.goods.isverify==1 && pagedata.goods.isendtime==1) " class="fui-cell fui-cell-credit">
                    <div class="fui-cell-text">
					<div ng-if="pagedata.goods.isendtime==1">使用有效期: 截止至{{pagedata.goods.endtime_str}}</div>
					<div ng-if="pagedata.goods.isendtime!=1">使用有效期: 兑换之日起 {{pagedata.goods.usetime}} 天内</div>
					</div>
                </div>
            
          
            <div ng-if="pagedata.goods.total>0" class="fui-cell fui-cell-credit">
                <div class="fui-cell-text"><div>仅限: {{pagedata.goods.total}} 份 已参与: {{pagedata.logtotal}} 次</div></div>
            </div>

            <div ng-if="!empty(pagedata.goods.dispatch) && pagedata.goods.isverify==0" class="fui-cell fui-cell-credit">
                <div class="fui-cell-text">
                    <div ng-if="pagedata.isarray_dispatch==1">
                    邮费: {{pagedata.goods.dispatch.min}} ~ {{pagedata.goods.dispatch.max}} 元
                     </div>
					 <div ng-if="pagedata.isarray_dispatch==0 && pagedata.goods.dispatch==0">
                    邮费: 包邮
    
                     </div>
					<div ng-if="pagedata.isarray_dispatch==0 && pagedata.goods.dispatch!=0">
					 邮费:   &yen;{{pagedata.goods.dispatch}}   
					 </div>
                </div>
            </div>
 
            <div class="fui-cell">
                <div class="fui-cell-text flex">
                    <span class="price" style="text-align: left;">
                        <span class="big" ng-if="pagedata.goods.mincredit>0">{{pagedata.goods.mincredit}}</span>
                        <span class="big" ng-if="pagedata.goods.mincredit<=0">{{pagedata.post.taocan.credit}}</span>{{pagedata.post.taocan.credit_title || '积分'}}
                             <span ng-if="pagedata.post.taocan.money>0" style="font-size: 0.8rem;font-weight: bold;padding-right: 0.1rem;"> +&yen;{{pagedata.post.taocan.money}}</span>
                         <span class="old">原价:{{pagedata.goods.price}}元</span>
                    </span>
                </div>
				<div ng-if="pagedata.goods.is_moretype==1" class="fui-cell-remark" ng-click="pagedata.showcreditmore=true;">
					更多兑换方式
				</div>
            </div>
        </div>
        <div ng-if="pagedata.goods.hasoption==1" class="fui-cell-group fui-cell-click">
            <div class="fui-cell">
                <div class="fui-cell-text store">请选择规格及数量</div>
                <div class="fui-cell-remark fui-cell-info" id="optionid">
                    <input type="hidden" placeholder="请选择规格" id="carrier_optionid" value="{{pagedata.member.realname}}" class="fui-input">
                </div>
            </div>
        </div>
		<!--已选参数-->
		<div ng-if="pagedata.selespename" class="fui-cell-group  fui-sale-group">
		<div class="fui-cell">
		<div class="fui-cell-label ">已选</div>
        <div class="fui-cell-text" style="color:#333"></div>
		<div class="fui-cell-remark bold" onclick="$('#showspec').modal();" ng-click="">
		{{pagedata.selespename}}{{pagedata.post.num}}件
		</div>
		</div>
		</div>
		<div ng-if="!pagedata.selespename && pagedata.goods.goodstype!=1" class="fui-cell-group  fui-sale-group">
		<div class="fui-cell">
		<div class="fui-cell-label ">数量</div>
        <div class="fui-cell-text" style="color:#333"></div>
				<div class="fui-cell-mask noremark">
					 <div class="fui-number">
						<div class="minus" ng-click="pagedata.minus()">-</div>
						<input class="num" type="text" name="" ng-model="pagedata.post.num"/>
						<div class="plus" ng-click="pagedata.plus()">+</div>
					</div>
				</div>
		</div>
		</div> 
        <div ng-if="pagedata.goods.detailshow==1 || pagedata.set.isdetail==1" class="fui-list-group">
            <div class="fui-list">
                <div class="fui-list-inner">
                    <div class="title">兑换流程</div>
                    <div ng-if="pagedata.goods.detailshow==1" class="text" ng-bind-html="trust(pagedata.goods.detail)"></div>
                    <div ng-if="pagedata.goods.detailshow!=1 && pagedata.set.isdetail==1" class="text" ng-bind-html="trust(pagedata.set.detail)"></div>
   
                </div>
            </div>
        </div>
        
        
        <div ng-if="pagedata.goods.noticedetailshow==1 || pagedata.set.isnoticedetail==1" class="fui-list-group">
            <div class="fui-list">
                <div class="fui-list-inner">
                    <div class="title">注意事项</div>
						<div ng-if="pagedata.goods.noticedetailshow==1" class="text" ng-bind-html="trust(pagedata.goods.noticedetail)"></div>
						<div ng-if="pagedata.goods.noticedetailshow!=1 && pagedata.set.isnoticedetail==1" class="text" ng-bind-html="trust(pagedata.set.noticedetail)"></div>
                </div>
            </div>
        </div>
    

        <div class="fui-tab fui-tab-danger detail-tab" id="detailTab">
            <a data-tab="basic" class="active">商品详情</a>
            <a ng-if="pagedata.set.isreply==1" data-tab="comment">评价</a>
            <a data-tab="records">参与记录</a>
        </div>

        <div class="detail-block">
            <div ng-if="pagedata.goods.goodsdetail" class="block block-basic tab-basic" ng-bind-html="trust(pagedata.goods.goodsdetail)" id="basic">
            </div>
			<div ng-if="!pagedata.goods.goodsdetail" class="block block-basic tab-basic" id="basic">
				暂无商品详情
            </div>      
            <div ng-if="pagedata.set.isreply==1" class="block block-comment tab-basic" id="comment">
                <div ng-if="pagedata.replytotal" class="comments" id="comments_reply">
                   
                    <div ng-repeat="item in pagedata.replys" class="item">
                        <div class="userinfo">
                            <div class="user">
                                <img ng-src="{{tomedia(item.headimg)}}">
                                <span>{{item.nickname}}</span>
                                <span class="date">{{item.time_str}}</span>
                            </div>
                            <div class="feel">
								<span ng-if="item.level>0" class="shine">★</span>
								<span ng-if="item.level>1" class="shine">★</span>
								<span ng-if="item.level>2" class="shine">★</span>
								<span ng-if="item.level>3" class="shine">★</span>
								<span ng-if="item.level>4" class="shine">★</span> 
                            </div>
                        </div>
                        <div class="comment">{{item.content}}</div>
                        <div ng-repeat="images in item.images" class="comment-images">
                            <img ng-src="{{tomedia(images)}}">
                        </div>
                        
                        <div ng-if="!empty(item.reply_content) || !empty(item.reply_images)" class="comment-reply">
                            卖家回复: {{item.reply_content}}
                            <div ng-repeat="images in item.reply_images" class="comment-images">
                                <img ng-src="{{tomedia(images)}}">  
                            </div>
                        </div>
                        
                        <div ng-if="item.append_time>0" class="comment">追加评论：{{item.append_content}}</div>
                        <div ng-if="item.append_time>0" ng-repeat="images in item.append_images" class="comment-images">
                             <img ng-src="{{tomedia(images)}}">
                        </div>
                        <div ng-if="!empty(item.append_reply_content) || !empty(item.append_reply_images)" class="comment-reply">
                            卖家回复: {{item.append_reply_content}}
                            <div ng-repeat="images in item.append_reply_images" class="comment-images">
								<img ng-src="{{tomedia(images)}}">
                            </div>
                        </div>
                    </div>
                   
                </div>
               
                <div ng-if="pagedata.replytotal>2" class="more replymore"><a href="javascript:void(0);">查看更多({{ifelse(pagedata.replytotal>999,'999+',pagedata.replytotal)}})</a></div>
              
                
                <div ng-if="empty(pagedata.replytotal)" class="detail-block block-basic">
                    暂无评价！
                </div>
                
            </div>
           
                <div ng-repeat="item in pagedata.list" class="item">
                    <div class="userinfo">
                        <div class="user">
							<img ng-src="{{tomedia(item.headimg)}}">
                            <span>{{item.nickname}}</span>
                            <span class="date">{{item.time_str}}</span>
                        </div>
                        <div class="feel">
                           <span ng-if="item.level>0" class="shine">★</span>
								<span ng-if="item.level>1" class="shine">★</span>
								<span ng-if="item.level>2" class="shine">★</span>
								<span ng-if="item.level>3" class="shine">★</span>
								<span ng-if="item.level>4" class="shine">★</span> 
                        </div>
                    </div>
                    <div class="comment">{{item.content}}</div>
                    <div ng-repeat="img in item.images" class="comment-images">
						<img ng-src="{{tomedia(img)}}">
                    </div>
                   
                    <div ng-if="item.reply_time > 0" class="comment-reply">
                        卖家回复: {{item.reply_content}}
                        <div ng-repeat="img in item.reply_images" class="comment-images">
                           <img ng-src="{{tomedia(img)}}"> 
                        </div>
                    </div>
                   
                  
                    <div ng-if="item.append_time > 0" class="comment">追加评论：{{item.append_content}}</div>
                    <div ng-if="item.append_time > 0" ng-repeat="img in item.append_images" class="comment-images">
                       <img ng-src="{{tomedia(img)}}"> 
                    </div>
                    <div ng-if="item.append_reply_time > 0" class="comment-reply">
                        卖家追加回复: {{item.append_reply_content}}
                        <div ng-repeat="img in item.append_reply_images" class="comment-images">
                            <img ng-src="{{tomedia(img)}}"> 
                        </div>
                    </div>    
                </div>


            
            <div class="block block-records tab-basic" id="records">
                <div ng-if="pagedata.logtotal>0" id="loglist">
                    <div ng-repeat="item in pagedata.log" class="fui-list">
                        <div class="fui-list-media">
                            <img ng-src="{{item.avatar}}">
                        </div>
                        <div class="fui-list-inner">
                            <div class="title" style="font-size:0.7rem;">{{item.nickname}}</div>
                            <!--<div class="text">x 10</div>-->
                        </div>
                        <div class="fui-list-media" style="font-size:0.6rem;color:#666">{{item.createtime_str}}</div>
                    </div>
                </div>
               
                <div ng-if="pagedata.logtotal>2" class="more logmore"><a href="javascript:void(0);"> 查看更多({{ifelse(pagedata.logtotal>999,'999+',pagedata.logtotal)}})</a></div>      
                
                <div ng-if="pagedata.logtotal==0" class="detail-block block-basic">
                    暂无参与记录！
                </div>
            </div>
        </div>
		
            <div ng-repeat="item in pagedata.loglist" class="fui-list">
                <div class="fui-list-media">
                    <img ng-src="{{tomedia(item.avatar)}}">
                </div>
                <div class="fui-list-inner">
                    <div class="title" style="font-size:0.7rem;">{{item.nickname}}</div>
                    <!--<div class="text">x 10</div>-->
                </div>
                <div class="fui-list-media" style="font-size:0.6rem;color:#666">{{item.createtime_str}}</div>
            </div>
        <div class="fui-list-group">
            <div class="fui-list noclick">
                <div class="fui-list-inner">
                    <div class="title">为您推荐</div>
                    <div class="text recommend">
                        <div ng-repeat="item in pagedata.goodsrec" class="item">
                            <a href="javascript:;" ng-click="access_json('jy_juanfee/creditshop.goods_detail/main/id='+item.id)">
                            <img ng-src="{{tomedia(item.thumb) ||'../core/resource/images/nopic.jpg'}}" />
                            <div class="title">{{item.title}}</div>
                            <div class="price">
                               {{ifelse(item.mincredit>0,item.mincredit,item.credit)}}积分
                                <span ng-if="item.money>0" style="font-weight: bold;padding-right: 0.1rem;">+ &yen;{{item.money}}</span>
                                
                            </div>
                            </a>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
       
        <div ng-if="pagedata.goods.subdetail" class="fui-list-group">
            <div class="fui-list">
                <div class="fui-list-inner">
                    <div class="title">提供商家介绍</div>
                    <div class="text" ng-bind-html="trust(pagedata.goods.subdetail)"></div>
                </div>
            </div>
        </div>


    </div>
    <div ng-if="pagedata.goods.canbuy==1" class="fui-footer btn-danger" style="z-index: 108;">
        <div ng-click="access_json('jy_juanfee/creditshop.create//goodsid='+pagedata.post.goodsid+'&num='+pagedata.post.num+'&optionsid='+pagedata.options.id+'&taocankey='+pagedata.post.taocankey)" id="openActionSheet">
                {{ifelse(pagedata.goods.type==1,'立即抽奖','立即兑换')}}
        </div>
    </div>
	<div ng-if="pagedata.goods.canbuy==2" class="fui-footer btn-disabled" style="z-index: 108;">
        <div id="openActionSheet">         
                {{pagedata.goods.buymsg}}
        </div>
    </div>
</div>
<div id="showspec" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0;bottom:0">
<div class="modal-content">
    <div class="option-picker ">
	<div class="option-picker-inner">
	<div class="option-picker-cell goodinfo">
	    <div class="closebtn"><i class="icon icon-guanbi1"></i></div>
	    <div class="img"><img class='thumb' src="{{tomedia(pagedata.goods.thumb)}}" /></div>
	    <div class="info info-price text-danger">
			<span>
				￥
				<span class='price' style="font-weight:600">
				{{pagedata.options.price}}
				</span>
			</span>
		</div>
	    <div class="info info-total">
	    	库存 <span class='total'>{{pagedata.options.total}}</span> 件
	    </div>
	<div class="info info-titles" ng-if="pagedata.specs.length>0">请选择规格</div>
	</div>
	<div class="option-picker-options">
	    <div ng-repeat="(k,spec) in pagedata.specs_list" class="option-picker-cell option spec">
		<div class="title">{{spec.title}}</div>
		<div class="select">
		     <a ng-repeat="item in spec.items" href="javascript:;" ng-click="pagedata.get_optionsid();pagedata.post.specid[k]=item.id" ng-class="{'btn btn-default btn-sm nav spec-item':1,'btn-select':pagedata.post.specid[k]==item.id}"> {{item.title}} </a>
		</div>
	    </div>
		<div class="fui-cell-group noborder" style="margin-top:0">
			<div class="fui-cell noborder">
			<div class="fui-cell-label">数量</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-mask noremark">
				 <div class="fui-number">
					<div class="minus" ng-click="pagedata.minus()">-</div>
					<input class="num" type="tel" name="" value="{{pagedata.post.num}}"/>
					<div class="plus" ng-click="pagedata.plus()">+</div>
				</div>
			</div>
			</div>
		</div>
	</div>
	<div class="fui-navbar">
	    <a href="javascript:;" aria-hidden="true" data-dismiss="modal" class="nav-item btn confirmbtn">确定</a>
	</div>
    </div>
    </div>

</div>
</div>
</div>
<div ng-include="sys_html('_creditmore')"></div>
<script type="text/javascript">
require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
		
});
//滚动加载
$(window).scroll(function(){
	var s =$(window).scrollTop();
	if(s > 100){
		scope.showtop = true;  //状态标记
	}else{
		scope.showtop = false;  //状态标记
	}
});
//减少
scope.pagedata.minus=function(){
	if(scope.pagedata.post.num <=1){
		return false;
	}
	scope.pagedata.post.num--;
	scope.$evalAsync();
}
//增加
scope.pagedata.plus=function(){
	scope.pagedata.post.num++;
	scope.$evalAsync();
}
//选择
scope.pagedata.get_optionsid=function(){
	var specid = scope.pagedata.post.specid;
		specid = specid.join('_');
	var params={
		data:{'specid':specid},
		op:'get_optionsid',
		callback:function(res){
			scope.pagedata.post.optionsid=res.options.id;
			scope.pagedata.options=res.options;
			scope.pagedata.selespename=res.selespename;
			scope.pagedata.post.taocan.money=res.options.price;
			scope.pagedata.post.taocan.credit=res.options.credit;
			scope.$evalAsync();
		}
	};
	scope.post_json(params);
}
scope.pagedata.uptaocan=function(item){
	scope.pagedata.post.totalprice=item.money*scope.pagedata.post.num;
	scope.pagedata.post.totalcredit=item.credit*scope.pagedata.post.num;
	scope.$evalAsync();
}
</script>

<!-- {template 'creditshop/picker'} -->
<script>
    $("#detailTab a").unbind('click').click(function () {
        var tab = $(this).data('tab');
        $(this).addClass('active').siblings().removeClass('active');
        $("#"+tab).show().siblings().hide();
    });


</script>
